package com.gxc.mall.user.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import java.util.HashMap;
import java.util.Map;

/**
 * @author GongXincheng
 * @since 2019-09-03 15:41
 */
@RestController
public class HelloController {

    @GetMapping(value = "/hello")
    public String hello() {
        return "Hello World -> [cloud-mall-service-user]";
    }

    @GetMapping(value = "/hello2")
    public Object hello2() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("username", "admin");
        map.put("pwd", "123qwe");
        return map;
    }

    @GetMapping(value = "/hello3")
    public Object hello3(@RequestParam("name") String name) {
        Map<String, Object> map = new HashMap<>(16);
        map.put("username", name);
        map.put("pwd", "123qwe");
        return map;
    }
}
